package logic

import (
	"context"
	"fmt"
	"wet/model/cache"

	"wet/wetrpc/internal/svc"
	"wet/wetrpc/wetrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShopDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopDelLogic {
	return &ShopDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 购物车指定移除
func (l *ShopDelLogic) ShopDel(in *wetrpc.ShopDelRequest) (*wetrpc.ShopDelResponse, error) {
	// todo: add your logic here and delete this line

	err := cache.ShopDel(in.UserId, in.ShopId)
	if err != nil {
		return nil, fmt.Errorf("删除失败")
	}
	return &wetrpc.ShopDelResponse{
		Success: true,
		Message: "删除成功",
	}, nil
}
